

<title>刷卡管理</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>应用</cite></a>
    <a><cite>刷卡管理</cite></a>
  </div>
</div>
<form class="layui-form">
  <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
  <div class="layui-form-item">
    <label class="layui-form-label">资源室编号</label>
    <div class="layui-input-inline">
      <input type="text" name="readRoomId" id="readRoomId" placeholder="请输入"
        autocomplete="off" class="layui-input">
    </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">会员卡号</label>
      <div class="layui-input-inline">
        <input type="text" name="cardNo" id="cardNo" placeholder="请输入"
          autocomplete="off" class="layui-input">
      </div>
    <label class="layui-form-label">进入或退出</label>
    <div class="layui-input-inline">
      <select name="inOrOut" id="inOrOut">
        <option value="">--请选择--</option>
        <option value="true">true</option>
        <option value="false">false</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="shuaka">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
  <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</form>
<script>
  layui.use(['laydate','jquery','form'], function(){
    var $ = layui.jquery;
    var form=layui.form;
  var laydate = layui.laydate;
  form.on('submit(shuaka)', function(data){
    var field = data.field; //获取提交的字段
    var readRoomId = document.getElementById("readRoomId").value;
    var cardNo = document.getElementById("cardNo").value;
    var inOrOut = document.getElementById("inOrOut").value;
    console.log(readRoomId)
    console.log(cardNo)
    console.log(inOrOut)
    $.ajax({
                url:"/consumeLog/"+readRoomId+"/"+cardNo+"/"+inOrOut,
                type:"post",
                async:false,
                data:{
                  readRoomId:readRoomId,
                  cardNo:cardNo,
                  inOrOut:inOrOut
                },//转换json格式
                contentType:"application/json",
                dataType: 'json',
                success:function(data){ 
                  admin.events.refresh();
                }
              })

});
  });
  
</script>

            <div class="layui-fluid">
            <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="app-content-comment">
             <div class="layui-form-item">
      </div>
    </div>
    <table id="LAY-app-content-comm" lay-filter="LAY-app-content-comm"></table>
    <script type="text/html" id="table-content-com">
      <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
    </script>
  </div>
</div>


<script>
layui.use('contlist', layui.factory('contlist')).use(['admin', 'contlist', 'table'], function(){
  var $ = layui.$
  ,admin = layui.admin
  ,view = layui.view
  ,table = layui.table
  ,form = layui.form;
  
  form.render(null, 'app-content-comment');
   //监听搜索
  form.on('submit(LAY-app-contcomm-search)', function(data){
 var field = data.field;
  //执行重载
  table.reload('LAY-app-content-comm', {
    where: field
  });
});
//点击事件
var active = {
batchdel: function(){
 var checkStatus = table.checkStatus('LAY-app-content-comm')
 ,checkData = checkStatus.data; //得到选中的数据
 if(checkData.length === 0){
   return layer.msg('请选择数据');
 }
 layer.confirm('确定删除吗？', function(index) {
   //执行 Ajax 后重载
   /*
   admin.req({
     url: 'xxx'
     //,……
   });
   */
   table.reload('LAY-app-content-comm');
   layer.msg('已删除');
 });
}
}  

  $('.layui-btn.layuiadmin-btn-comm').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
});
</script>
